package cn.wildfire.chat.app.main;

import android.os.Bundle;
import android.view.KeyEvent;

import androidx.annotation.Nullable;

import com.kyleduo.switchbutton.SwitchButton;
import com.sourcemuch.im.caiba.R;import com.sourcemuch.im.caiba.R2;

import butterknife.BindView;
import cn.wildfire.chat.app.extendsion.BaseActivity;
import cn.wildfire.chat.app.extendsion.utils.NotificationUtils;

/**
 * Create by HEKE, 2019/8/16 11:27
 * TODO 新消息通知界面
 */
@Deprecated
public class NewSettingActivity extends BaseActivity {

    @BindView(R2.id.newsSwitchButton)
    SwitchButton newsSwitchButton;
    @BindView(R2.id.newDtailsSwitchButton)
    SwitchButton newDtailsSwitchButton;

    @Override
    public void initViews() {
        bindBack();
        setBarTitle(R.string.news_msg_set);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_news_setting);
    }

    /**
     * 设置通知开关显示
     */
    private void setNotifyStatus() {
        boolean areNotificationsEnabled = NotificationUtils.isNotificationEnabled(this);
        newsSwitchButton.setCheckedNoEvent(areNotificationsEnabled);
    }

    @Override
    protected void onResume() {
        super.onResume();
        setNotifyStatus();
    }


    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
            onBackPressed();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

}
